__author__ = 'mayday'
#delete '#' before the print statement to test the function :)
def sum(a, b):
    return a + b

#print sum(1,3)
def biggest(a, b, c):
    num = a
    if num < b:
        num = b
    if num < c:
        num = c
    return num

#print biggest(2,2,4)
def print_numbers(num):
    i = 1
    while i <= num:
        print i
        i+=1

#print_numbers(10)

def factorial(n):
    res = 1
    while n >= 1:
        res *= n
        n-=1
    return res

#print factorial(5)

#swap s t
s, t = 1, 5
#print s,t
s, t = t, s
#print s,t

def get_next_target(page):
    start_link = page.find('<a href=')
    if start_link == -1:#no links
        return None, 0
    start_quote = page.find('"', start_link)
    end_quote = page.find('"', start_quote + 1)
    url = page[start_quote + 1:end_quote]
    return url, end_quote

url, end_pos = get_next_target("there is no link")
if url:#if is none it is false
    pass
    #print 'Here'
else:
    pass
    #print 'Not Here'
def print_all_links(page):
    url,end_pos=get_next_target(page)
    while True:
        if url:
            page=page[end_pos:]
            print url
        else:
            break
page='<a href="http://top.baidu.com"></a> | <a href="http://home.baidu.com"></a> | <a href="http://ir.baidu.com">About Baidu</a>'
#print_all_links(page)
#To test socks5-http proxy for intellij